
Dog = {}

function Dog:new()
  newDog={sound="wang"}
  -- newDog.__index=self
  self.__index=self
  return setmetatable(newDog, self)
end


-- function new(self)
--   newDog={sound="wang"}
--   self.__index=self
--   return setmetatable(newDog, self)
-- end

function Dog:cry()
  print(self.sound)
end

dogA = Dog:new()
-- dogA = new(Dog)
print(type(dogA))
dogA:cry()


-- inherites

-- LoudDog = new(Dog)
LoudDog = Dog:new()
function LoudDog:cry()
  print("loud cry: " .. self.sound)
end

-- ss = new (LoudDog)
ss = LoudDog:new()
ss:cry()